// index.js
// 获取应用实例
const app = getApp()
const {extend, getRouter} = require('../../utils/router.js')
Page({
  data: {
    isIpx: app.globalData.isIpx
  },
  router:{
    fn:'changePage',
    name:'index',
    key: 'showIndex',
    destroy: 'destroy',
    default: 0
  },
  onLoad() {

    // console.log(this.selectComponent('.footer'))
    // this.selectComponent('.footer').changeEvent(0)
  },
  onShow(){
    console.log(this.data.showIndex,'onShow')
  },
  changePage(){
   let showIndex = this.data.showIndex
    if (showIndex == 0) {
      this.setData({
        title:'鲜丰水果官网'
      })
    } else if (showIndex == 1) {
      this.setData({
        title:'购物车'
      })
    }else{
      this.setData({
        title:''
      })
    }
  },
  toshopCar(){
    this.selectComponent('.footer').changeEvent(1)
  },
  onPageScroll (e) {
    console.log(e)
    if(e.scrollTop > 0){
      this.setData({
        filter:e.scrollTop / 20
      })
    }else{
      this.setData({
        filter:0
      })
    }
  },
  onShareAppMessage(){
    return {
      title: 'index'
    }
  },
  // onReachBottom (e) {
  //   console.log(345)
  //   wx.showToast({
  //     title: '触底了23',
  //     icon:"none"
  //
  //   })
  // }
})
